<template xmlns:v-clipboard="http://www.w3.org/1999/xhtml">
    <transition name="slide-right">
        <v-touch class="SK-box" v-on:swiperight="">
            <header class="mui-bar  mui-bar-transparent immerse-margin">
                <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" @click="backRoute()"></a>
                <h1 class="mui-title">{{ $t('m.wallet.qrcode.listTitle') }}</h1>
                <!--TODO
                <span class="mui-icon mui-icon-upload "></span>-->
            </header>
            <div class="SK-codebox">
                <div class="SK-titimg">
                    <img :src="walletActive.avatar" alt="">
                </div>
                <div class="SK-top">
                    <p>Wallet-{{ walletActive.index }}</p>
                    <p>
                        <span>{{ walletActive.address }}</span>
                        <span style="margin-left: 3px;">
                            <img src="@/assets/img/coffer/copy.png" class="coffer-copy2" alt=""
                                 v-clipboard:copy="walletActive.address"
                                 v-clipboard:success="doClipboard"
                                 v-clipboard:error="">
                        </span>
                    </p>
                </div>
                <div class="SK-bottom">
                    <p>{{ $t('m.wallet.qrcode.prompt[0]') }}</p>
                    <canvas id="canvas23232323"></canvas>
                </div>
            </div>
            <Alert_little></Alert_little>
        </v-touch>
    </transition>
</template>
<script>
    /* eslint-disable */
    import QRCode from 'qrcode';

    export default {
        name: 'wallet_qrcode',
        created() {
        },
        mounted() {
            this.showQrcode();
        },

        data() {
            return {}
        },
        methods: {
            showQrcode: function () {
                let canvas = document.querySelector('#canvas23232323');
                QRCode.toCanvas(canvas, this.walletActive.address, {
                    width: 160,
                    margin: 2
                }, function (error) {
                    console.log(error)
                })
            },
            doClipboard: function () {
                this.aAlert_little({
                    msg: this.$t('m.wallet.qrcode.prompt[1]'),
                    top: "220px"
                })
            },
        }
    }

</script>
<style scoped>
    @import '../../assets/css/accountList.css';

    .SK-box {
        background: rgba(53, 60, 76, .7);
        height: 100%;
    }

    .SK-box .mui-title {
        color: #fff;
    }

    .SK-box .mui-icon-left-nav {
        color: #fff;
        padding-right: 10px;
        padding-left: 10px;
        margin-left: -.3rem;
    }

    .SK-box .mui-icon-upload {
        color: #fff;
        float: right;
    }

    .SK-codebox {
        width: 90%;
        height: 55%;
        position: relative;
        left: 50%;
        top: 13%;
        transform: translateX(-50%);
        background: #fff;
        border-radius: .2rem .2rem;
    }

    .SK-titimg {
        position: absolute;
        left: 50%;
        top: -.4rem;
        transform: translate(-50%);
        width: .8rem;
        height: .8rem;
        border-radius: .1rem .1rem;
        background: #fff;
        overflow: hidden;
    }

    .SK-titimg img {
        width: 100%;
        height: 100%;
    }

    .SK-top {
        height: 1.7rem;
        background: #0A8CC7;
        border-radius: .2rem .2rem 0 0;
        text-align: center;
        padding-top: .7rem;
    }

    .SK-top > p {
        color: #fff;
    }

    .SK-top > p:nth-of-type(1) {
        margin-bottom: 0;
        font-size: .32rem;
    }

    .SK-top > p:nth-of-type(2) {
        font-size: .24rem;
    }

    .SK-top img{
        vertical-align: top;
        margin-top: 0.06rem;
    }

    .SK-bottom {
        text-align: center;
        position: absolute;
        left: 50%;
        top: 32%;
        transform: translateX(-50%);
    }

    .SK-bottom > p {
        font-size: .36rem;
        color: #000;
        margin-bottom: .3rem;
    }

    .SK-bottom > img {
        width: 3.2rem;
        height: 3.2rem;
    }

    .coffer-copy2 {
        width: .28rem;
        height: .24rem;
        vertical-align: middle;
    }
</style>
